/*
 * Copyright (c) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef NAPI_CAR_CTL_CLI_H
#define NAPI_CAR_CTL_CLI_H

#include <vector>
#include <string>

#include "napi/native_common.h"
#include "napi/native_node_api.h"

#define MAX_BUFFER_SIZE 128

struct AsyncCallbackInfo {
    napi_env env;
    napi_async_work asyncWork;
    napi_deferred deferred;
    napi_ref callback[2] = {0};
};

struct NetAddress{
    char address[MAX_BUFFER_SIZE];
    int port;
};

struct TCPConnectionOptions{
    // NetAddress netAddress;
    struct {
        char address[MAX_BUFFER_SIZE];
        int port;
    } netAddress;
    int32_t timeout;
};

struct AsyncCallbackInfo_connectCar{
    napi_env env;
    napi_async_work asyncWork;
    napi_deferred deferred;
};

void NAPI_Bear_Controller_Client_Init(napi_env env, napi_value exports);
napi_value NAPI_Bear_Controller_Client_Constructor(napi_env env, napi_callback_info info);
napi_value NAPI_Connect(napi_env env, napi_callback_info info);
napi_value NAPI_Send(napi_env env, napi_callback_info info);
napi_value NAPI_Close(napi_env env, napi_callback_info info);


#endif  
